From: Nicolas BESNARD Date: Fri, 25 Oct 2024 15:24:34 +0000 (+0200) Subject: dhcpv6: add t1 and t2 transmission X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22%24PHP_SELF/%22https:/collectd.org/%22%24PHP_SELF?a=commitdiff_plain;h=047c63a8156bc1908824cb327667e4b222677701;p=project%2Fodhcp6c.git dhcpv6: add t1 and t2 transmission Problem: there was no way to get access to the t1 and t2 that the dhcpv6 server sends to the client Solution: add the timing in the Prefix and Address sent to the environment. Signed-off-by: Nicolas BESNARD Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcp6c/pull/106 Signed-off-by: Álvaro Fernández Rojas --- diff --git a/src/script.c b/src/script.c index 4b06c69..0f4be34 100644 --- a/src/script.c +++ b/src/script.c @@ -171,7 +171,7 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en size_t buf_len = strlen(name); const struct odhcp6c_entry *e = data; // Worst case: ENTRY_PREFIX with iaid != 1 and exclusion - const size_t max_entry_len = (INET6_ADDRSTRLEN-1 + 5 + 22 + 15 + 10 + + const size_t max_entry_len = (INET6_ADDRSTRLEN-1 + 5 + 44 + 15 + 10 + INET6_ADDRSTRLEN-1 + 11 + 1); char *buf = realloc(NULL, buf_len + 2 + (len / sizeof(*e)) * max_entry_len); @@ -208,7 +208,7 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en snprintf(&buf[buf_len], 23, ",%u,%u", e[i].valid, e[i].priority); buf_len += strlen(&buf[buf_len]); } else { - snprintf(&buf[buf_len], 23, ",%u,%u", e[i].preferred, e[i].valid); + snprintf(&buf[buf_len], 45, ",%u,%u,%u,%u", e[i].preferred, e[i].valid, e[i].t1, e[i].t2); buf_len += strlen(&buf[buf_len]); }